package com.ruoyi.data.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.data.domain.BondCbAdjLogsJsl;
import com.ruoyi.data.service.IBondCbAdjLogsJslService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 价格调整Controller
 * 
 * @author leng.xz
 * @date 2024-05-02
 */
@Controller
@RequestMapping("/data/jslAdj")
public class BondCbAdjLogsJslController extends BaseController
{
    private String prefix = "data/jslAdj";

    @Autowired
    private IBondCbAdjLogsJslService bondCbAdjLogsJslService;

    @RequiresPermissions("data:jslAdj:view")
    @GetMapping()
    public String jslAdj()
    {
        return prefix + "/jslAdj";
    }

    /**
     * 查询价格调整列表
     */
    @RequiresPermissions("data:jslAdj:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(BondCbAdjLogsJsl bondCbAdjLogsJsl)
    {
        startPage();
        List<BondCbAdjLogsJsl> list = bondCbAdjLogsJslService.selectBondCbAdjLogsJslList(bondCbAdjLogsJsl);
        return getDataTable(list);
    }

    /**
     * 导出价格调整列表
     */
    @RequiresPermissions("data:jslAdj:export")
    @Log(title = "价格调整", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(BondCbAdjLogsJsl bondCbAdjLogsJsl)
    {
        List<BondCbAdjLogsJsl> list = bondCbAdjLogsJslService.selectBondCbAdjLogsJslList(bondCbAdjLogsJsl);
        ExcelUtil<BondCbAdjLogsJsl> util = new ExcelUtil<BondCbAdjLogsJsl>(BondCbAdjLogsJsl.class);
        return util.exportExcel(list, "jslAdj");
    }

    /**
     * 新增价格调整
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存价格调整
     */
    @RequiresPermissions("data:jslAdj:add")
    @Log(title = "价格调整", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(BondCbAdjLogsJsl bondCbAdjLogsJsl)
    {
        return toAjax(bondCbAdjLogsJslService.insertBondCbAdjLogsJsl(bondCbAdjLogsJsl));
    }

    /**
     * 修改价格调整
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        BondCbAdjLogsJsl bondCbAdjLogsJsl = bondCbAdjLogsJslService.selectBondCbAdjLogsJslById(id);
        mmap.put("bondCbAdjLogsJsl", bondCbAdjLogsJsl);
        return prefix + "/edit";
    }

    /**
     * 修改保存价格调整
     */
    @RequiresPermissions("data:jslAdj:edit")
    @Log(title = "价格调整", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(BondCbAdjLogsJsl bondCbAdjLogsJsl)
    {
        return toAjax(bondCbAdjLogsJslService.updateBondCbAdjLogsJsl(bondCbAdjLogsJsl));
    }

    /**
     * 删除价格调整
     */
    @RequiresPermissions("data:jslAdj:remove")
    @Log(title = "价格调整", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(bondCbAdjLogsJslService.deleteBondCbAdjLogsJslByIds(ids));
    }
}
